package view;

import java.awt.Dimension;
import java.awt.event.ActionEvent;

import javax.swing.JButton;

import javax.swing.WindowConstants;
import org.jdesktop.application.Application;

import javax.swing.AbstractAction;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextArea;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class PanelAltaReceta extends javax.swing.JPanel {
	private JLabel jLabelAltaReceta;
	private JTextArea jTextAreaReceta;
	private JButton jButtonCancelar;
	private JButton jButtonGuardar;
	private JLabel jLabelInstrucciones;
	private AbstractAction actionCancelar;
	private AbstractAction actionBuscItems;
	private JButton jButtonBuscarItems;
	private static PanelAltaReceta instancia;
	
	public static PanelAltaReceta getInstancia(){
		if(instancia==null){
			instancia=new PanelAltaReceta();
		}
		return instancia;
	}
	
	private PanelAltaReceta() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			this.setSize(400, 219);
			this.setLayout(null);
			{
				jLabelAltaReceta = new JLabel();
				this.add(jLabelAltaReceta);
				jLabelAltaReceta.setBounds(130, 12, 108, 14);
				jLabelAltaReceta.setName("jLabelAltaReceta");
			}
			{
				jLabelInstrucciones = new JLabel();
				this.add(jLabelInstrucciones);
				jLabelInstrucciones.setBounds(23, 45, 117, 14);
				jLabelInstrucciones.setName("jLabelInstrucciones");
			}
			{
				jTextAreaReceta = new JTextArea();
				this.add(jTextAreaReceta);
				jTextAreaReceta.setBounds(102, 65, 223, 92);
				jTextAreaReceta.setName("jTextAreaReceta");
			}
			{
				jButtonGuardar = new JButton();
				this.add(jButtonGuardar);
				jButtonGuardar.setBounds(102, 174, 85, 21);
				jButtonGuardar.setName("jButtonGuardar");
			}
			{
				jButtonCancelar = new JButton();
				this.add(jButtonCancelar);
				this.add(getJButtonBuscarItems());
				jButtonCancelar.setBounds(210, 174, 93, 22);
				jButtonCancelar.setName("jButtonCancelar");
				jButtonCancelar.setAction(getActionCancelar());
			}
			
			
			Application.getInstance().getContext().getResourceMap(getClass()).injectComponents(this);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
	
	private AbstractAction getActionCancelar(){
		if(actionCancelar == null) {
			actionCancelar = new AbstractAction("Cancelar", null) {
				public void actionPerformed(ActionEvent evt) {
					jTextAreaReceta.setText("");
					instancia.setVisible(false);
				}
			};
		}
		return actionCancelar;
    }
	
	private JButton getJButtonBuscarItems() {
		if(jButtonBuscarItems == null) {
			jButtonBuscarItems = new JButton();
			jButtonBuscarItems.setBounds(196, 38, 129, 21);
			jButtonBuscarItems.setName("jButtonBuscarItems");
			jButtonBuscarItems.setAction(getActionBuscarItems());
		}
		return jButtonBuscarItems;
	}
	
	private AbstractAction getActionBuscarItems(){
		if(actionBuscItems == null) {
			actionBuscItems = new AbstractAction("Buscar Items", null) {
				public void actionPerformed(ActionEvent evt) {
					FrameSelecItems frame=FrameSelecItems.getInstancia();
					frame.setVisible(true);
				}
			};
		}
		return actionBuscItems;
    }

}
